package com.acsior.hibernate.vo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import com.acsior.dac.impl.hibernate.vo.GeneratorKey;
import com.acsior.ddfn.impl.hibernate.vo.TreeNomElementVO;

/**
 * Structure entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "structures", uniqueConstraints = @UniqueConstraint(columnNames = "system_name"))
@GeneratorKey(tableName = "structures")
public class StructureVO extends TreeNomElementVO<StructureVO> {

	private static final long serialVersionUID = 4586805235292939581L;

	@Column(name = "address")
	private String address;

	@Column(name = "director_name", length = 150)
	private String directorName;

	@Column(name = "do_last_number", nullable = false)
	private Integer doLastNumber;

	@Column(name = "email", length = 50)
	private String email;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "structure")
	private List<EmployeeVO> employees;

	@Column(name = "fax_number", length = 20)
	private String faxNumber;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "invoice_ops_data_id")
	private InvoiceOpsDataVO invoiceOpsData;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "invoice_ru_data_id")
	private InvoiceRuDataVO invoiceRuData;

	@Column(name = "is_active", nullable = false)
	private boolean isActive;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "structure_type_id", nullable = false)
	private NomStructureTypeVO nomStructureType;

	@Column(name = "phone", length = 20)
	private String phone;

	@Column(name = "postal_code", nullable = false, length = 4)
	private String postalCode;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "structure")
	private List<PostCodeVO> postCodes;

	@Column(name = "worktime_from", length = 23)
	private Date worksFrom;

	@Column(name = "worktime_to", length = 23)
	private Date worksTo;

	/** default constructor */
	public StructureVO() {
		this.employees = new ArrayList<EmployeeVO>();
		this.postCodes = new ArrayList<PostCodeVO>();
	}

	/**
	 * @return стойността на address
	 */
	public String getAddress() {
		return this.address;
	}

	/**
	 * @see com.acsior.ddfn.impl.hibernate.vo.TreeNomElementVO#getChildren()
	 */
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "structure")
	@Override
	public List<StructureVO> getChildren() {
		return super.getSublings();
	}

	/**
	 * @return стойността на directorName
	 */
	public String getDirectorName() {
		return this.directorName;
	}

	/** @return the doLastNumber */
	public Integer getDoLastNumber() {
		return this.doLastNumber;
	}

	/**
	 * @return стойността на email
	 */
	public String getEmail() {
		return this.email;
	}

	/**
	 * @return стойността на employees
	 */
	public List<EmployeeVO> getEmployees() {
		return this.employees;
	}

	/**
	 * @return стойността на faxNumber
	 */
	public String getFaxNumber() {
		return this.faxNumber;
	}

	/** @return the invoiceOpsData */
	public InvoiceOpsDataVO getInvoiceOpsData() {
		return this.invoiceOpsData;
	}

	/** @return the invoiceRuData */
	public InvoiceRuDataVO getInvoiceRuData() {
		return this.invoiceRuData;
	}

	/**
	 * @return стойността на nomStructureType
	 */
	public NomStructureTypeVO getNomStructureType() {
		return this.nomStructureType;
	}

	/**
	 * @return стойността на phone
	 */
	public String getPhone() {
		return this.phone;
	}

	/** @return the postalCode */
	public String getPostalCode() {
		return this.postalCode;
	}

	/** @return the postCodes */
	public List<PostCodeVO> getPostCodes() {
		return this.postCodes;
	}

	/**
	 * @return стойността на worksFrom
	 */
	public Date getWorksFrom() {
		return this.worksFrom;
	}

	/**
	 * @return стойността на worksTo
	 */
	public Date getWorksTo() {
		return this.worksTo;
	}

	/**
	 * @return стойността на isActive
	 */
	public boolean isActive() {
		return this.isActive;
	}

	/**
	 * @param isActive
	 *            се залага в isActive
	 */
	public void setActive(boolean isActive) {
		this.isActive = isActive;
	}

	/**
	 * @param address
	 *            се залага в address
	 */
	public void setAddress(String address) {
		this.address = address;
	}

	/**
	 * @param directorName
	 *            се залага в directorName
	 */
	public void setDirectorName(String directorName) {
		this.directorName = directorName;
	}

	/** @param doLastNumber */
	public void setDoLastNumber(Integer doLastNumber) {
		this.doLastNumber = doLastNumber;
	}

	/**
	 * @param email
	 *            се залага в email
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @param employees
	 *            се залага в employees
	 */
	public void setEmployees(List<EmployeeVO> employees) {
		this.employees = employees;
	}

	/**
	 * @param faxNumber
	 *            се залага в faxNumber
	 */
	public void setFaxNumber(String faxNumber) {
		this.faxNumber = faxNumber;
	}

	/** @param invoiceOpsData */
	public void setInvoiceOpsData(InvoiceOpsDataVO invoiceOpsData) {
		this.invoiceOpsData = invoiceOpsData;
	}

	/** @param invoiceRuData */
	public void setInvoiceRuData(InvoiceRuDataVO invoiceRuData) {
		this.invoiceRuData = invoiceRuData;
	}

	/**
	 * @param nomStructureType
	 *            се залага в nomStructureType
	 */
	public void setNomStructureType(NomStructureTypeVO nomStructureType) {
		this.nomStructureType = nomStructureType;
	}

	/**
	 * @param phone
	 *            се залага в phone
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	/**
	 * @param postalCode
	 *            the postalCode to set
	 */
	public void setPostalCode(String postalCode) {
		this.postalCode = postalCode;
	}

	/**
	 * @param postCodes
	 *            the postCodes to set
	 */
	public void setPostCodes(List<PostCodeVO> postCodes) {
		this.postCodes = postCodes;
	}

	/**
	 * @param worksFrom
	 *            се залага в worksFrom
	 */
	public void setWorksFrom(Date worksFrom) {
		this.worksFrom = worksFrom;
	}

	/**
	 * @param worksTo
	 *            се залага в worksTo
	 */
	public void setWorksTo(Date worksTo) {
		this.worksTo = worksTo;
	}

}